home *** CD-ROM | disk | FTP | other *** search
/ IBM OEM Software Product … CD For PC Manufacturers / IBM OEM Software - Product Sampler CD for PC Manufacturers.iso / InternetIntranets / Notes / INSTALL.DSK / LANGUAGE.LSS < prev    next >
Text File  |  1995-11-15  |  28KB  |  722 lines

  1.  
  2. ''/*********************************************************************
  3. ''
  4. ''   Module Name:   language.lss
  5. ''
  6. ''   Module Code:   TOOLKIT
  7. ''
  8. ''   Author:              JMDonohue
  9. ''   Creation Date:  May 15, 1995
  10. ''
  11. ''   Copyright Lotus Development Corporation, (c) 1995
  12. ''
  13. ''
  14. ''  
  15. ''   Description: 
  16. ''     Lotus script file for language processing in common install
  17. ''   
  18. ''   
  19. ''   Additional authors:
  20. ''
  21. ''   Change History:
  22. ''   $Log:   //CIT/VOL1/CFLOG/logfiles/cominst/toolkit/language.l@s  $
  23. '' 
  24. ''    Rev 1.34.1.1   15 Nov 1995 17:07:34   mhishinu
  25. '' Merged GC5 into FE5
  26. '' 
  27. ''    Rev 1.34.1.0   Oct 19 1995 14:05:38   cmoy
  28. '' merged fe3 to fe5
  29. '' 
  30. ''    Rev 1.34   16 Oct 1995 10:54:30   jdonohue
  31. '' Removed high-bit (non ASCII) characters
  32. '' 
  33. ''    Rev 1.33   26 Sep 1995 16:35:46   jdonohue
  34. '' Removed extraneous line
  35. '' 
  36. ''    Rev 1.32   26 Sep 1995 16:14:56   jdonohue
  37. '' Replace C function FindRegistryLanguage with script function
  38. '' Local function IsLanguageInstalled has product name, version arguments
  39. '' PopupLanguageInstallMessage has product name as argument, not language acrony
  40. '' Added sub InitLanguages that records install kind for global and products
  41. '' Obsolete symbol SYM_INSTALLED_LANGUAGES$
  42. '' 
  43. ''    Rev 1.31   21 Sep 1995 15:11:08   jdonohue
  44. '' 
  45. '' Changed 0 to FALSE
  46. '' 
  47. ''    Rev 1.30   13 Sep 1995 08:01:46   jdonohue
  48. '' Removed error case from AddRegistryLanguage
  49. '' 
  50. ''    Rev 1.29   12 Sep 1995 11:55:32   jdonohue
  51. '' Added PopupLanguageInstallMessage for language install message
  52. '' 
  53. ''    Rev 1.28   11 Sep 1995 17:00:04   jdonohue
  54. '' No language install for distribution case
  55. '' 
  56. ''    Rev 1.27   24 Aug 1995 16:21:50   jdonohue
  57. '' Use string literal for language name in language install message
  58. '' 
  59. ''    Rev 1.26   21 Aug 1995 15:41:30   amontalv
  60. '' Put name of registry keys into globals.lss
  61. '' 
  62. ''    Rev 1.25   17 Aug 1995 15:02:54   jdonohue
  63. '' Added functions to handle node install of server secondary language
  64. '' 
  65. ''    Rev 1.24   15 Aug 1995 10:33:26   jdonohue
  66. '' Create registry language keys for language install if necessary
  67. '' 
  68. ''    Rev 1.23   14 Aug 1995 13:55:34   jdonohue
  69. '' Don't set language install for server install from registry values
  70. '' 
  71. ''    Rev 1.22   11 Aug 1995 12:58:50   jdonohue
  72. '' Language install if not primary language
  73. '' Added function IsLanguageInstalled
  74. '' 
  75. ''    Rev 1.21   10 Aug 1995 10:54:58   jdonohue
  76. '' Changed language install message box handling
  77. '' 
  78. ''    Rev 1.20   10 Aug 1995 07:50:52   jdonohue
  79. '' Switched arguments for language install message
  80. '' 
  81. ''    Rev 1.19   04 Aug 1995 15:17:48   jdonohue
  82. '' Made Lot_SetLanguageDirectory PUBLIC
  83. '' 
  84. ''    Rev 1.18   04 Aug 1995 11:57:08   jdonohue
  85. '' Fixed bug rewriting registry languages on reinstall
  86. '' 
  87. ''    Rev 1.17   25 Jul 1995 13:38:46   jdonohue
  88. '' Allow user to exit language install
  89. '' 
  90. ''    Rev 1.16   21 Jul 1995 08:13:38   jdonohue
  91. '' Added language acronyms from ccstr header
  92. '' 
  93. ''    Rev 1.15   20 Jul 1995 15:00:14   jdonohue
  94. '' Only pop up message box for language install
  95. '' 
  96. ''    Rev 1.14   18 Jul 1995 12:39:02   jdonohue
  97. '' Use standard Lotus Install title for language/reinstall message box
  98. '' 
  99. ''    Rev 1.13   12 Jul 1995 16:58:12   jdonohue
  100. '' Made Lot_SetLanguageDirectory more robust
  101. '' 
  102. ''    Rev 1.12   21 Jun 1995 14:02:00   jdonohue
  103. '' Creates installed and default language keys/values if necessary
  104. '' 
  105. ''    Rev 1.11   09 Jun 1995 16:45:58   jdonohue
  106. '' Lot_SetLanguageDirectory returns blank if language acronym blank
  107. '' 
  108. ''    Rev 1.10   05 Jun 1995 16:37:28   amontalv
  109. '' Made changes for migrating to LotusScript version 3.0.37.
  110. '' 
  111. ''    Rev 1.9   26 May 1995 15:33:22   jdonohue
  112. '' Exits initlanguage of product name or version not supplied
  113. '' 
  114. ''    Rev 1.8   24 May 1995 12:26:56   jdonohue
  115. '' Fixed chapter finding logic
  116. '' 
  117. ''    Rev 1.7   22 May 1995 11:03:50   jdonohue
  118. '' Made IsInstallLanguageSection local function
  119. '' 
  120. ''    Rev 1.6   19 May 1995 15:16:00   jdonohue
  121. '' Added product number argument to SetLanguageSectionsOn
  122. '' 
  123. ''    Rev 1.5   19 May 1995 14:56:26   jdonohue
  124. '' Added functions to turn language sections on, and to retrieve language subdir
  125. '' 
  126. ''    Rev 1.4   18 May 1995 15:37:06   jdonohue
  127. '' Added function to update registry installed languages
  128. '' 
  129. ''    Rev 1.3   18 May 1995 13:32:54   jdonohue
  130. '' Added function to generate language subdirectory
  131. '' 
  132. ''    Rev 1.2   18 May 1995 10:51:38   jdonohue
  133. '' Changed InitLanguage to be called by clients in XXX.LSS, e.g.
  134. '' 
  135. ''    Rev 1.1   17 May 1995 08:27:48   jdonohue
  136. '' Changed upgrade logic -- no message
  137. '' 
  138. ''    Rev 1.0   16 May 1995 17:12:46   jdonohue
  139. '' Initial Revision
  140. '' 
  141. ''----------------------------------------------------------------------
  142. ''   Date     Vers. Pgmr  SPR#  Change
  143. ''----------------------------------------------------------------------
  144. '' 05-15-95   0001  JMD         Initial
  145. ''
  146. ''----------------------------------------------------------------------
  147. ''
  148. ''*********************************************************************/
  149.  
  150. '**************************************************************************
  151. '*******************************  Windows API's  **************************
  152. '**************************************************************************
  153.  
  154. USE "RESOURCE"
  155. USE "GLOBALS"
  156. USE "SHARE"
  157. OPTION DECLARE
  158.  
  159. CONST LANGKEYWORD$="LANG"                
  160. DIM LanguagesInit AS INTEGER
  161. DIM LanguageDirectorySymbolList LIST AS STRING
  162. PUBLIC SrcDirResetFlag AS INTEGER    'Lets us know we've reset SYM_STF_BASEDIR
  163.                                             'for a node install in a secondary server
  164.                                             'language (!)
  165.  
  166. '**************************C CALLOUT PROTOTYPES*************************
  167.  
  168. 'OBSOLETE: !!SYM_INSTALLED_LANGUAGES$ symbol not used JMD@
  169. 'OBSOLETE: !! Should delete from bldcui C function JMD@
  170. 'DECLARE PUBLIC FUNCTION FindRegistryLanguages LIB "msshlstf.dll" _
  171. '         ALIAS "_FindRegistryLanguages@20" (ByVal szAppName$, ByVal VerMajor%, _
  172. '         ByVal VerMinor%, ByVal szInstalled$, ByVal nInstalled&) AS INTEGER
  173. DECLARE PUBLIC FUNCTION AddLanguageToRegistry LIB "msshlstf.dll" _
  174.          ALIAS "_AddLanguageToRegistry@16" (ByVal szAppName$, ByVal VerMajor%, _
  175.          ByVal VerMinor%, ByVal szLangKW$ ) AS LONG
  176. DECLARE PUBLIC FUNCTION FRefreshLanguageSource LIB "lcomstf.dll" _
  177.          ALIAS "_FRefreshLanguageSource@8" (ByVal szSymbol$, ByVal szLangKW$ ) AS INTEGER
  178.  
  179. DECLARE PUBLIC SUB InitLanguages(szProductName$, szProductVersion$, prodno%) 
  180. DECLARE PUBLIC SUB InitLanguage(szProductName$, szProductVersion$, _
  181.                         szInstallKind$, szLanguageSubdir$) 
  182. DECLARE PUBLIC SUB SetLanguageSubdir( szTarget$, szSource$ ) 
  183. DECLARE PUBLIC SUB AddRegistryLanguage(szProductName$, szProductVersion$) 
  184. DECLARE PUBLIC SUB Lot_SetLanguageSectionsOn (ProdNo%) 
  185. DECLARE PUBLIC FUNCTION Lot_SetLanguageDirectory(szLanguageAcronym$) AS STRING
  186. DECLARE PUBLIC SUB RefreshLanguageSourceDirectories
  187. DECLARE PUBLIC SUB MarkSourceLanguageSubdir(szSubdirSymbol$)
  188. DECLARE PUBLIC FUNCTION IsServerSecondaryLanguage AS INTEGER
  189. DECLARE PUBLIC SUB PopupLanguageInstallMessage( lang$)
  190.  
  191. '** Private functions
  192. DECLARE FUNCTION IsInstallLanguageSection( szSectionKeyword$) AS INTEGER 
  193. DECLARE FUNCTION IsLanguageInstalled(szProductName$, szProductVersion$) AS INTEGER
  194. DECLARE FUNCTION FindRegistryLanguages(szProductName$, szProductVersion$) AS STRING
  195.  
  196. PUBLIC SUB InitLanguages(szProductName$, szProductVersion$, prodno%) 
  197. '*************************************************************************
  198. '** Purpose: Finds out the installed languages and determines the nature
  199. '**  of the install.  If not running automated, displays a message box for
  200. '**  language install; for an upgrade or a reinstall, just continues
  201. '**  Sets symbols for install kind for install and for individual products in 
  202. '**  Suite
  203. '**  
  204. '** Author: JMDonohue
  205. '** Arguments: 
  206. '**   szProductName$    Product name for registry, e.g., "Approach"
  207. '**   szProductVersion$ Product version for registry, e.g., "2.1"
  208. '**   prodno%                 Product number from toolkit
  209. '**   
  210. '**  Obtains values for the following global symbols:
  211. '**   SYM_INSTALL_LANGUAGE$
  212. '**  Sets values for the following global symbols:
  213. '**   SYM_INSTALL_KIND$
  214. '**   SYM_INSTALL_KINDS$ (list)
  215. '**   
  216. '*************************************************************************
  217.     DIM szInstallKind$, szDummy$ 
  218.     InitLanguage szProductName$, szProductVersion$, szInstallKind$, szDummy$  
  219.     ' Set the overall install kind based on first product (suite case)
  220.     IF prodno% = 1 THEN SetSymbolValue SYM_INSTALLKIND$, szInstallKind$
  221.     ' Set the product install kinds for client use in scripts
  222.     SetListItem SYM_INSTALLKINDS$, prodno%, szInstallKind$
  223. '** Inform the user what's happening (only for product 1 (suite or single))
  224.     IF prodno% <> 1 THEN EXIT SUB
  225.    IF szInstallKind$ =  gLANGUAGEINSTALL$ THEN _
  226.         PopupLanguageInstallMessage( szProductName$ )
  227. END SUB
  228.  
  229.  
  230. PUBLIC SUB InitLanguage(szProductName$, szProductVersion$, _
  231.                         szInstallKind$, szLanguageSubdir$) 
  232. '*************************************************************************
  233. '** Purpose: Finds out the installed languages and determines the nature
  234. '**  of the install.  If not running automated, displays a message box for
  235. '**  language install; for an upgrade or a reinstall, just continues
  236. '**  
  237. '** Author: JMDonohue
  238. '** Arguments: 
  239. '**   szProductName$    Product name for registry, e.g., "Approach"
  240. '**   szProductVersion$ Product version for registry, e.g., "2.1"
  241. '**   Returns:
  242. '**   szInstallKind$    One of:  gUPGRADE
  243. '**                              gREINSTALL
  244. '**                              gLANGUAGEINSTALL
  245. '**   szLanguageSubdir$ Subdirectory name for other than primary language 
  246. '**                     files, e.g., "Francais"
  247. '**   
  248. '**  Obtains values for the following global symbols from resources:
  249. '**   SYM_INSTALL_LANGUAGE$
  250. '**   
  251. '**  Sets the following global symbols:
  252. '**   SYM_LANGUAGE_SUBDIR$     
  253. '*************************************************************************
  254.    DIM  i%, dbl#, s$, lang$, network$
  255.    DIM szInstalled$, nInstalled& 
  256.    nInstalled = 128        'Size of installed languages string
  257.     
  258.     szInstallKind$ = gUPGRADE$        'Default
  259. '** Set language of install and its subdirectory (once only)
  260.    if LanguagesInit  = 0 Then
  261.       s$ = LdString(SID_LANGUAGE)
  262.       SetSymbolValue SYM_INSTALL_LANGUAGE$, s$
  263.       s$ = Lot_SetLanguageDirectory(s$) 
  264.       SetSymbolValue SYM_LANGUAGE_SUBDIR$, s$
  265.       LanguagesInit  = 1
  266.    End if
  267.  
  268.    IF szProductName$ = "" THEN EXIT SUB
  269.    IF szProductVersion$ = "" THEN EXIT SUB
  270.     network$ =  GetSymbolValue(SYM_NETWORK$) 
  271.     ' MLC Does not apply to distribution, and server determines it from
  272.     ' cinstall.ini
  273.     IF network$ = gSERVER$ THEN EXIT SUB
  274.     IF network$ = gDISTRIBUTION$ THEN EXIT SUB
  275.    szInstalled$ = STRING$(nInstalled&, 0) 
  276. '** Find the list of installed languages for product/version
  277.    szInstalled$ = FindRegistryLanguages(szProductName$, szProductVersion$)
  278.    szInstalled$ = NullTrim(szInstalled$)
  279.    if szInstalled$ = "" Then
  280. '** Product/version not installed == Upgrade
  281.       SetSymbolValue SYM_INSTALLKIND$, gUPGRADE$
  282.       szInstallKind$ = gUPGRADE$
  283.       szLanguageSubdir$ = ""  '** Goes in with content
  284.       EXIT Sub
  285.    end if
  286. '** Find out if our language is primmary
  287.    lang$ = GetSymbolValue(SYM_INSTALL_LANGUAGE$)
  288.    s$ = Lot_GetNthFieldFromIniString(szInstalled$, 1, "") 
  289.     s$ = LEFT(s$, 2)    ' Paranoia
  290.    if s$ = lang$ then
  291.    '** Found the primary language and the version, must be reinstall
  292.       szInstallKind$ =  gREINSTALL$
  293.       szLanguageSubdir$ = ""     '** Goes in with content
  294.       EXIT Sub
  295.    end if
  296. '** Got this far, we must be language install, set the directory and kind
  297.    szLanguageSubdir$ = GetSymbolValue (SYM_LANGUAGE_SUBDIR$)
  298.    szInstallKind$ =  gLANGUAGEINSTALL$
  299.    
  300. END SUB
  301.  
  302. '**************************************************************************
  303. '** SUB PopupLanguageInstallMessage( szProductName$)
  304. '** Purpose: Displays a dialog telling the user a language install is
  305. '** occurring and requesting confirmation; if answered no, exits install
  306. '**  
  307. '** Author: JMDonohue
  308. '** Arguments: szProductName$    Product Name
  309. '**   
  310. '*************************************************************************
  311. PUBLIC SUB PopupLanguageInstallMessage( szProductName$)
  312.     DIM msg$, i%, s$, title$, rc&
  313.     
  314. '** Set the standard title for install messages
  315.    title$ = LdString(SID_TKT_STD_TITLE)
  316.     msg$  = LdString(SID_LANGUAGEINSTALL_MSG)
  317.    i% = instr(msg$,"%s")
  318.    s$ = mid$(msg$, 1, i%-1) + szProductName$ + mid$(msg$, i%+2)
  319.    if GetSymbolValue(SYM_AUTOMATIONINST$) = gTRUE$ THEN EXIT SUB
  320.     DO
  321.       rc& = DoMsgBox(s$, title$, MB_YESNO)
  322.         if CINT(rc&) = IDYES  THEN 
  323.             EXIT SUB
  324.         ELSE
  325.             QUIT
  326.         END IF
  327.     LOOP 
  328. END SUB
  329.  
  330. '**************************************************************************
  331. '** FUNCTION IsInstallLanguageSection( szSectionKeyword$) AS INTEGER
  332. '** Purpose: Determines if section is part of a language pack for the language
  333. '** currently being installed by matching the ending of the name with the
  334. '** keyword "LANG??" where "??" is a two character acronym for the language
  335. '**  
  336. '** Author: JMDonohue
  337. '** Arguments: szSectionKeyword$    keyword for section from .inf file
  338. '** Returns:   TRUE if a section for the language we are installing
  339. '**  Uses the following global symbols: 
  340. '**   SYM_INSTALL_LANGUAGE$
  341. '**   
  342. '*************************************************************************
  343. FUNCTION IsInstallLanguageSection( szSectionKeyword$) AS INTEGER
  344.    DIM LangKey$, LangAcronym$, InstallLanguage$, s$, leng%
  345.    s$ = szSectionKeyword$
  346.    leng% = Len(s$)
  347.    if leng% < 6 Then
  348.       IsInstallLanguageSection = FALSE
  349.    Else
  350.    LangKey$ = UCase$(Right$(s$,6))
  351.    LangAcronym$ = Right$(LangKey$,2)
  352.    InstallLanguage$ = GetSymbolValue(SYM_INSTALL_LANGUAGE$)
  353.  
  354.    LangKey$ = Left$(LangKey$,4)
  355.    If LangKey$ = LANGKEYWORD$ Then
  356.       If LangAcronym$ = InstallLanguage$ Then
  357.          IsInstallLanguageSection = TRUE
  358.       Else
  359.          IsInstallLanguageSection = FALSE
  360.       End if
  361.    Else
  362.       IsInstallLanguageSection = FALSE
  363.    End if
  364.    End if
  365. END FUNCTION
  366.  
  367.  
  368. FUNCTION IsLanguageInstalled(szProductName$, szProductVersion$) AS INTEGER
  369. '**************************************************************************
  370. '** Purpose: Determines if the current language is already installed by 
  371. '** examining the registry entries for product/version
  372. '**  
  373. '** Author: JMDonohue
  374. '** Arguments: 
  375. '**   szProductName$    Product name for registry, e.g., "Approach"
  376. '**   szProductVersion$ Product version for registry, e.g., "2.1"
  377. '** 
  378. '** Returns:   Index of language, or 0 if not installed
  379. '**  Uses the following global symbols: 
  380. '**   SYM_INSTALL_LANGUAGE$
  381. '**   
  382. '*************************************************************************
  383.    DIM lang$, installed$, s$, i%
  384.  
  385.     IsLanguageInstalled = 0
  386.     i% = 1
  387.     lang$ = GetSymbolValue(SYM_INSTALL_LANGUAGE$)
  388.    installed$ = FindRegistryLanguages(szProductName$, szProductVersion$)
  389.     if installed$ = "" THEN EXIT FUNCTION
  390.     DO
  391.         s$ = Lot_GetNthFieldFromIniString(installed$ , i%, "") 
  392.         s$ = LEFT(s$, 2)        ' Paranoia
  393.         if s$ = lang$ then
  394.             IsLanguageInstalled = i%
  395.             EXIT FUNCTION
  396.         end if
  397.         i% = i% + 1
  398.     LOOP WHILE (s$<>"")
  399. END FUNCTION
  400.  
  401.  
  402. '**************************************************************************
  403. '** SUB SetLanguageSubdir( szTarget$, szSource$ ) 
  404. '** Purpose: For a language install, sets the value of target symbol to the
  405. '**   value of source symbol with the language subdirectory appended
  406. '**  
  407. '** Author: JMDonohue
  408. '** Arguments: szTarget$   Target symbol for language subdirectory
  409. '**            szSource$   Symbol for base component directory
  410. '** Returns:   
  411. '**  Uses the following global symbols: 
  412. '**   SYM_LANGUAGE_SUBDIR$
  413. '**   
  414. '*************************************************************************
  415. PUBLIC SUB SetLanguageSubdir( szTarget$, szSource$ ) 
  416.     DIM s$
  417.     s$ = GetSymbolValue(SYM_LANGUAGE_SUBDIR$) + "\"
  418.     s$ = MakePath(GetSymbolValue(szSource$), s$) 
  419.    SetSymbolValue szTarget$, s$ 
  420. END SUB
  421.  
  422.  
  423. '*************************************************************************
  424. '** SUB AddRegistryLanguage(szProductName$, szProductVersion$)
  425. '** Purpose: When a language install completes, updates the list of 
  426. '** installed languages for the product/version; for a first time install,
  427. '** create the appropriate key and value
  428. '**  
  429. '** Author: JMDonohue
  430. '** Arguments: 
  431. '**   szProductName$    Product name for registry, e.g., "Approach"
  432. '**   szProductVersion$ Product version for registry, e.g., "2.1"
  433. '**   Returns: TRUE if sucessful
  434. '** 
  435. '**************************************************************************
  436. PUBLIC SUB AddRegistryLanguage(szProductName$, szProductVersion$)
  437.    DIM szLangKW$, Ret&
  438.    DIM VerMajor%, VerMinor%, dbl#
  439.     DIM szkey$, keyvalue$
  440.  
  441.     IF szProductName$ = "" THEN EXIT SUB
  442.     IF szProductVersion$ = "" THEN EXIT SUB
  443.    szkey$ = gREGLOTUS + szProductName$ + "\" + szProductVersion$ + "\Languages"
  444.    szLangKW$ = GetSymbolValue(SYM_INSTALL_LANGUAGE$)
  445.  
  446. '** Create the key if it doesn't exist or add to existing value
  447.     IF Lot_DoesRegKeyExistEx(HKEY_LOCAL_MACHINE, szkey$) = FALSE THEN
  448.         Ret& = Lot_RegCreateKeyEx(HKEY_LOCAL_MACHINE, szkey$)
  449.         'if Ret& <> 0 then print "Could not create registry key " szkey$
  450. '** New product/version, create language registry values
  451.         keyvalue$ = "Installed"
  452.         Ret& = Lot_CreateRegKeyValueEx(HKEY_LOCAL_MACHINE, szkey$, keyvalue$, _
  453.             REG_SZ, szLangKW$, lenbp(szLangKW$)+1) ''** HISHI - Aug/23/95
  454.         'if Ret& <> 0 then print "Could not create registry value " szkey$
  455.         keyvalue$ = "Default"
  456.         Ret& = Lot_CreateRegKeyValueEx(HKEY_LOCAL_MACHINE, szkey$, keyvalue$, _
  457.             REG_SZ, szLangKW$, lenbp(szLangKW$)+1) ''** HISHI - Aug/23/95
  458.         'if Ret& <> 0 then print "Could not create registry value " szkey$
  459.     ELSE
  460. '** Add the current language to the "Installed" key in registry if not already
  461. '** there
  462.  
  463.         IF IsLanguageInstalled(szProductName$, szProductVersion$) <> 0 THEN EXIT SUB
  464.         VerMajor% = CInt(szProductVersion$)
  465.         dbl# = CDbl(szProductVersion$) -CDbl(VerMajor%)
  466.         VerMinor% = CInt(dbl#*10)
  467.         '!! This should be done in script -- obsolete C function JMD@
  468.         Ret& = AddLanguageToRegistry(szProductName$, VerMajor%, VerMinor%, szLangKW$) 
  469.         'if Ret& <> 0 then print "Could not add language to registry: " szlangKW$
  470.     END IF
  471.    
  472. END SUB
  473.  
  474.  
  475. '*************************************************************************
  476. '** SUB Lot_SetLanguageSectionsOn (ProdNo%)
  477. '**
  478. '** Purpose:   Sets language sections for copying (off by default)
  479. '** Author:    Jack Donohue
  480. '** Arguments: ProdNo%    Product number 
  481. '** Returns:   
  482. '*************************************************************************
  483. PUBLIC SUB Lot_SetLanguageSectionsOn (ProdNo%) 
  484. DIM rc%, keyword$, chapter$, feature$, sym$, Sib$
  485.  
  486.    Sib$ = Lot_GetNextSibling(Str$(ProdNo%), F_NOTHING )
  487.    chapter$ = Lot_GetFirstChild(Str$(ProdNo%), F_NOTHING )
  488.                
  489. %rem     
  490.     If (chapter$ = "") then
  491.          ERROR STFQUIT
  492.     End if   
  493. %endrem     
  494.          
  495.     WHILE (chapter$ <> Sib$ )
  496.       '** Traverse all chapters, looking for sections with the language
  497.       '** keyword; if they belong to an installed feature, turn them on
  498.  
  499.       keyword$ = Lot_GetChapterValStr (chapter$, F_KEYWORD)
  500.       If IsInstallLanguageSection(keyword$) = TRUE Then
  501.          feature$ = Left(keyword$, Len(keyword$)-6)
  502.          feature$ = Lot_GetChapterFromKeyword (feature$)
  503.          rc% = Lot_GetChapterValInt (feature$, F_INOROUT)   
  504.          If rc% = 1 Then
  505.             rc% = Lot_SetChapterFilesInCopyListInOrOut (chapter$, 1)
  506.          End If
  507.       End If
  508.       '*** Goto next chapter
  509.       chapter$ = Lot_GetNext()  
  510.     WEND
  511. END SUB
  512.  
  513.  
  514. DIM LANGUAGEDIR LIST AS STRING
  515.  
  516. '*************************************************************************
  517. '** PUBLIC FUNCTION Lot_SetLanguageDirectory(szLanguageAcronym$) AS STRING
  518. '** Purpose: Looks up the directory name corresponding to the two letter
  519. '**   language acronym in internal table
  520. '**  
  521. '**  The acronyms are from the ccstr header file; language directory names
  522. '**  other than those commented need to be supplied
  523. '**  
  524. '** Author: JMDonohue
  525. '** Arguments: 
  526. '**   szLanguageAcronym$    Language acronym, e.g., "FR"
  527. '**   Returns: Subdirectory string, e.g., "Francais"
  528. '**************************************************************************
  529. PUBLIC FUNCTION Lot_SetLanguageDirectory(szLanguageAcronym$) AS STRING
  530.    if LanguagesInit  = 0 Then
  531. '**NOTE: Need to complete this sections, and/or resource it    
  532. '?? Catala: 6 characters [Catala]
  533.         LANGUAGEDIR("AM") = "Amharic"
  534.         LANGUAGEDIR("AR") = "Arabi"            'Arabic
  535.         LANGUAGEDIR("AS") = "Assamese"
  536.         LANGUAGEDIR("AY") = "Aymara"
  537.         LANGUAGEDIR("AZ") = "Azerbaijani"
  538.         LANGUAGEDIR("BE") = "Byelorussian"
  539.         LANGUAGEDIR("BG") = "Bulgarian"
  540.         LANGUAGEDIR("BN") = "Bengali"
  541.         LANGUAGEDIR("BO") = "Tibetan"
  542.         LANGUAGEDIR("CA") = "Catalan"
  543.         LANGUAGEDIR("CS") = "Ceska"            'Czech
  544.         LANGUAGEDIR("CY") = "Welsh"
  545.         LANGUAGEDIR("DA") = "Dansk"            'Danish
  546.         LANGUAGEDIR("DE") = "Deutsch"            'German
  547.         LANGUAGEDIR("EL") = "Hellenic"        'Greek
  548.         LANGUAGEDIR("EN") = "English"            'English
  549.         LANGUAGEDIR("EO") = "Esperanto"
  550.         LANGUAGEDIR("ES") = "Espanol"            'Spanish
  551.         LANGUAGEDIR("ET") = "Estonian"
  552.         LANGUAGEDIR("EU") = "Basque"
  553.         LANGUAGEDIR("FA") = "Farsi"            'Farsi
  554.         'LANGUAGEDIR("FA") = "Persian"
  555.         LANGUAGEDIR("FI") = "Suomi"            'Finnish
  556.         LANGUAGEDIR("FO") = "Faeroese"
  557.         LANGUAGEDIR("FR") = "Francais"        'French
  558.         LANGUAGEDIR("GN") = "Guarani"
  559.         LANGUAGEDIR("GU") = "Gujarati"
  560.         LANGUAGEDIR("HI") = "Hindi"
  561.         LANGUAGEDIR("HR") = "Croatian"
  562.         LANGUAGEDIR("HU") = "Magyar"            'Hungarian
  563.         LANGUAGEDIR("HY") = "Armenian"
  564.         LANGUAGEDIR("IN") = "Indonesian"
  565.         LANGUAGEDIR("IS") = "Icelandic"
  566.         LANGUAGEDIR("IT") = "Italian"            'Italian
  567.         LANGUAGEDIR("IW") = "Hebrew"            'Hebrew
  568.         LANGUAGEDIR("JA") = "Japanese"        'Japanese
  569.         LANGUAGEDIR("JI") = "Yiddish"
  570.         LANGUAGEDIR("KA") = "Georgian"
  571.         LANGUAGEDIR("KK") = "Kazakh"
  572.         LANGUAGEDIR("KM") = "Khmer"
  573.         LANGUAGEDIR("KN") = "Kannada"
  574.         LANGUAGEDIR("KO") = "Korean"            'Korean
  575.         LANGUAGEDIR("KS") = "Kashmiri"
  576.         LANGUAGEDIR("KU") = "Kurdish"
  577.         LANGUAGEDIR("KY") = "Kirghiz"
  578.         LANGUAGEDIR("LA") = "Latin"
  579.         LANGUAGEDIR("LO") = "Lao"
  580.         LANGUAGEDIR("LT") = "Lithuanian"
  581.         LANGUAGEDIR("LV") = "Latvian"
  582.         LANGUAGEDIR("LV") = "Lettish"
  583.         LANGUAGEDIR("MG") = "Malagasy"
  584.         LANGUAGEDIR("MK") = "Macedonian"
  585.         LANGUAGEDIR("ML") = "Malayalam"
  586.         LANGUAGEDIR("MN") = "Mongolian"
  587.         LANGUAGEDIR("MO") = "Moldavian"
  588.         LANGUAGEDIR("MR") = "Marathi"
  589.         LANGUAGEDIR("MY") = "Burmese"
  590.         LANGUAGEDIR("NE") = "Nepali"
  591.         LANGUAGEDIR("NL") = "Nederlan"        'Dutch
  592.         LANGUAGEDIR("NO") = "Norsk"            'Norwegian
  593.         LANGUAGEDIR("OR") = "Oriya"
  594.         LANGUAGEDIR("PA") = "Punjabi"
  595.         LANGUAGEDIR("PL") = "Polski"            'Polish
  596.         LANGUAGEDIR("PS") = "Pashto"
  597.         LANGUAGEDIR("PT") = "Portugue"        'Portuguese
  598.         LANGUAGEDIR("QU") = "Quechua"
  599.         LANGUAGEDIR("RM") = "RhaetoRomanic"
  600.         LANGUAGEDIR("RO") = "Romanian"
  601.         LANGUAGEDIR("RU") = "Russkiy"            'Russian
  602.         LANGUAGEDIR("SA") = "Sanskrit"
  603.         LANGUAGEDIR("SD") = "Sindhi"
  604.         LANGUAGEDIR("SH") = "Serbocroatian"
  605.         LANGUAGEDIR("SI") = "Sinhalese"
  606.         LANGUAGEDIR("SK") = "Slovenci"        'Slovak
  607.         LANGUAGEDIR("SL") = "Slovenian"
  608.         LANGUAGEDIR("SO") = "Somali"
  609.         LANGUAGEDIR("SQ") = "Albanian"
  610.         LANGUAGEDIR("SR") = "Serbian"
  611.         LANGUAGEDIR("SV") = "Svenska"            'Swedish
  612.         LANGUAGEDIR("SW") = "Swahili"
  613.         LANGUAGEDIR("TA") = "Tamil"
  614.         LANGUAGEDIR("TE") = "Telugu"
  615.         LANGUAGEDIR("TG") = "Tajiki"
  616.         LANGUAGEDIR("TH") = "Thai"                'Thai
  617.         LANGUAGEDIR("TI") = "Tigrinya"
  618.         LANGUAGEDIR("TK") = "Turkmen"
  619.         LANGUAGEDIR("TL") = "Tagalog"
  620.         LANGUAGEDIR("TR") = "Turkce"            'Turkish
  621.         LANGUAGEDIR("TT") = "Tatar"
  622.         LANGUAGEDIR("UK") = "Ukrainian"
  623.         LANGUAGEDIR("UR") = "Urdu"
  624.         LANGUAGEDIR("UZ") = "Uzbek"
  625.         LANGUAGEDIR("VI") = "Vietnamese"
  626.         LANGUAGEDIR("ZH") = "Chinese"            'Chinese
  627.    End if
  628.     if szLanguageAcronym$ = "" then
  629.         Lot_SetLanguageDirectory = ""
  630.         exit function
  631.     end if    
  632.     if (ISELEMENT(LANGUAGEDIR(szLanguageAcronym$)) <> 0 ) then
  633.         Lot_SetLanguageDirectory = LANGUAGEDIR(szLanguageAcronym$) 
  634.     Else
  635.         Lot_SetLanguageDirectory = ""
  636.     End if
  637. END FUNCTION 
  638.  
  639.  
  640. PUBLIC SUB RefreshLanguageSourceDirectories
  641. '*************************************************************************
  642. '** SUB RefreshLanguageSourceDirectories
  643. '** Purpose: Changes the source filepath to include the language subdirectory
  644. '**   This is only required for node install from a server in a secondary
  645. '**    language, since the content files have been installed in subdirectories
  646. '**    Traverses the list of destination path symbols that have been changed by
  647. '**    SetLanguageSubdir
  648. '**  
  649. '** Author: JMDonohue
  650. '** Arguments: 
  651. '**************************************************************************
  652.     DIM ret%
  653.  
  654.     FORALL sym IN LanguageDirectorySymbolList 
  655.         ret% = FRefreshLanguageSource(ListTag(sym), sym)
  656.     END FORALL
  657. END SUB
  658.  
  659. PUBLIC SUB MarkSourceLanguageSubdir(szSubdirSymbol$)
  660. '*************************************************************************
  661. '**  SUB MarkSourceLanguageSubdir(szSubdirSymbol$)
  662. '** Purpose: Adds the symbol to a list of subdirectory symbols that must
  663. '**    have a language subdirectory added to the source file names for files
  664. '**    whose section uses that symbol for the destination directory
  665. '**    This is needed for a node install from a server in a SERVER secondary
  666. '**    language
  667. '**  
  668. '** Author: JMDonohue
  669. '** Arguments: 
  670. '**************************************************************************
  671.     DIM s$
  672.  
  673.     s$ = GetSymbolValue(SYM_LANGUAGE_SUBDIR$) + "\"
  674.     if (ISELEMENT(LanguageDirectorySymbolList(szSubdirSymbol$)) = 0 ) then _
  675.         LanguageDirectorySymbolList(szSubdirSymbol$) = s$ 
  676. END SUB
  677.  
  678.  
  679. PUBLIC FUNCTION IsServerSecondaryLanguage AS INTEGER
  680. '*************************************************************************
  681. '**  FUNCTION IsServerSecondaryLanguage AS INTEGER
  682. '** Purpose: Determines is the current language is a secondary language on
  683. '**    the server, in which case clients must mark language symbols for 
  684. '**    resetting source file locations
  685. '**  
  686. '** Author: JMDonohue
  687. '** Arguments: 
  688. '** Returns:   TRUE if language is server secondary
  689. '**************************************************************************
  690.     DIM s$, installini$, proddir$
  691.  
  692.     IsServerSecondaryLanguage  = FALSE
  693. ' If the install directory is not the same as the base product directo
  694. ' install must be in a language subdirectory
  695.     s$ = GetSymbolValue(SYM_STF_CWDDIR$)
  696.     installini$ = s$ + gINSTALLINI$
  697.     s$ = GetIniKeyString(installini$, "Critical Directories", "INSTDIR")
  698.     proddir$ = GetIniKeyString(installini$, "Critical Directories",_
  699.         Reg_GetProductAcronym(1) + "DIR")
  700.     IF s$ <> proddir$ THEN IsServerSecondaryLanguage  = TRUE
  701.  
  702. END FUNCTION
  703.  
  704. FUNCTION FindRegistryLanguages(szProductName$, szProductVersion$) AS STRING
  705. '*************************************************************************
  706. '** Purpose: Find out what languages have been installed for the product
  707. '**  
  708. '** Author: JMDonohue
  709. '** Arguments: szProductName$        Product name in registry
  710. '**                szProductVersion$    Product version in registry
  711. '** 
  712. '** Returns:   List of installed languages
  713. '**************************************************************************
  714.    DIM szkey$, ret&, nsize&, gbuf$ 
  715.     FindRegistryLanguages = ""
  716.    szkey$ = gREGLOTUS + szProductName$ + "\" + szProductVersion$ + "\Languages"
  717.     IF Lot_DoesRegKeyExistEx(HKEY_LOCAL_MACHINE, szkey$) = FALSE THEN EXIT FUNCTION
  718.     ret& =  Lot_GetRegKeyValueEx(HKEY_LOCAL_MACHINE, szkey$, "Installed", 0, gbuf$, nsize&) 
  719.     FindRegistryLanguages = gbuf$
  720.  
  721. END FUNCTION
  722.